Not Applicable
Not Applicable
1. Field of the Invention
This invention relates to the distribution of events between an event generator object and one or more listener (recipient) objects within a data processing system, and particularly an object oriented data processing system.
2. Description of the Prior Art
In a data processing system, and particularly an object oriented data processing system implemented using the Java programming language, the C++ programming language, and others, events can be used to pass control from an event generator object to a listener object. Although control passes in one direction only, stack implementation of event constructs requires an implicit return to the event generator object at some point. This requirement for an implicit return is particularly true when more than one object is listening for an event. If the return to the event generator object is not done in a timely fashion, distribution of events may take place too late or not at all. It is also possible for the stack space to be exhausted while an event-passing task is being performed repeatedly.
By way of example, in an automated call processing center for a business or other enterprise, an incoming call may be processed by a call answering object that distributes call-related events to other call handling objects, such as an announcement playing object, a prompt-and-collect object, and a call routing object. Consider an example wherein the call answering object receives a new call and, in accordance with its programming, distributes a newcall event to other call handling objects. Consider further that the caller subsequently hangs up after the new call event is distributed, but before control is returned to the call answering object. The call answering object is programmed to respond to the caller hang-up by generating a call terminating event, so that call processing by the recipient objects can be discontinued and call processing resources can be freed up for other calls. If the call answering object is waiting for a return of the new call event (or some other event) when the call hang-up occurs, it will not be able to generate the call terminating event in a timely fashion, if at all.
Accordingly, there is a need in a data processing environment for a system and method that coordinates the prompt distribution of events without impairing generator object processing functions and without depleting stack space in stack-based event processing implementations. What is needed is a system and method for distributing events from an event generator to an event recipient (listener) while retaining control at the event generator, such that the event generator is, among other things, free to continue generating subsequent events to event recipients.
A system and method in accordance with the invention solves the foregoing problem and provides for the distribution of an event from an event generator to an event recipient (listener) while retaining control at the event generator. In accordance with the inventive system and method, an event generator generates events while running in a first execution thread. The generator""s events are then processed and distributed to one or more event recipients in one or more separate execution threads. In this way, the event generator is free to continue its processing functions, which may include generating subsequent events, without having to wait for processing of the initial event to complete.
In preferred embodiments of the invention, the event generator and event recipients are object oriented programming objects. The event generator object provides public methods that allow other objects to register and deregister themselves as event recipients for specified events. Event processing and distribution (as well as event recipient registration and deregistration) is handled by a manager object that is created to manage the event calls for the event generator object. When the event generator object generates an event, a distributor object is created and run on a new execution thread with a priority level higher than the execution thread on which the event generator object runs. The distributor object distributes the event to the appropriate event listener using the new thread, such that generator object processing may continue. Preferably, in order to accommodate multiple listeners, the distributor object generates a slave object for each event listener. Each slave object is assigned a new thread of execution with a priority equal to the priority of the event generator object""s thread of execution and lower than the priority of the distributor""s thread of execution, such that the distributor object can complete its functions before the slave objects begin distributing the event to the listener objects. The slave objects preferably distribute the event to the appropriate listeners by calling an interface created as part of the event generator object.